from django.db import models
#-*- coding: utf-8 -*-
# Create your models here.
class Host(models.Model):
    hostname = models.CharField(max_length=100)
    ip = models.GenericIPAddressField()
    osversion = models.CharField(max_length=100)
    memory = models.CharField(max_length=100)
    disk = models.CharField(max_length=100)
    vendor_id = models.CharField(max_length=100)
    model_name = models.CharField(max_length=100)
    cpu_core = models.CharField(max_length=100)
    product = models.CharField(max_length=200)
    Manufacturer = models.CharField(max_length=100)
    sn = models.CharField(max_length=200) 
    def __str__(self):
        return self.hostname
    class Meta:
        verbose_name = '主机信息'
        verbose_name_plural = '主机信息'
class HostGroup(models.Model): 
    groupname = models.CharField(max_length=50) 
    members = models.ManyToManyField(Host) 
    class Meta: 
        verbose_name = '主机组' 
        verbose_name_plural = '主机组'
class aliyun_ecs_info(models.Model):
    instanceid = models.CharField(max_length=50,unique=True) 
    zoneid = models.CharField(max_length=50) 
    instancename = models.CharField(max_length=50,unique=True) 
    osname = models.CharField(max_length=50) 
    publicipaddress = models.GenericIPAddressField(db_index = True) 
    privateipaddress = models.GenericIPAddressField(db_index = True) 
    bandwidthout = models.IntegerField() 
    status = models.CharField(max_length=20) 
    creationtime = models.CharField(max_length=50) 
    expiredtime = models.CharField(max_length=50) 
    class Meta: 
        verbose_name = '阿里云ECS信息' 
        verbose_name_plural = '阿里云ECS信息'
